﻿using System;
using System.Collections.Generic;
using System.Text;

namespace TSVNAddinUtils
{
	public abstract class UtilsCommandBase : IUtilsCommand
	{
		public void Exec(string[] args)
		{
			try
			{
				Console.WriteLine("{0} started...", GetClassName());
				InternalExec(args);
				Console.WriteLine("{0} completed.", GetClassName());
			}
			catch(Exception ex)
			{
				Console.WriteLine("{0} failed: \n{1}", GetClassName(), ex.Message);
			}
		}

		private string GetClassName()
		{
			return GetType().Name;
		}

		protected abstract void InternalExec(string[] args);
	}
}
